@page "/presentation/comment"
@inject Microsoft.JSInterop.IJSRuntime JS
@using System.IO
@using Syncfusion.Blazor.Buttons
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment
@using BlazorDemos.Data.FileFormats.Presentation
@inherits SampleBaseComponent;

<SampleDescription>
   <p style="font-size:16px">This sample demonstrates how to add comments to a presentation slide.</p> 
</SampleDescription>
<ActionDescription>
   <b style="font-size:16px">Features:</b>
    <br />
    <ul style="font-size:16px">
			<li>Support for adding, replying, editing comments in a PowerPoint slide.</li>            
    </ul>
    <br />
</ActionDescription>

<div class="control-section">
    <p style="font-size:16px">Click the button to view a PowerPoint presentation generated by Essential Presentation. Please note that Microsoft PowerPoint viewer or its equivalent is required to view the resultant document.</p>

    <div class="button-section">
        <div id="button-control">
            <div class="row">
                <div>
                    <SfButton @onclick="CreateComment">Create Presentation</SfButton>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
    .control-section .row {
        margin: 10px 0;
    }
</style>

@code {
    MemoryStream documentStream;

    /// <summary>
    /// Create and download the Presentation document
    /// </summary>
    public async Task CreateComment(MouseEventArgs args)
    {
        CommentService commentSample = new CommentService(hostingEnvironment);
        documentStream = commentSample.CreateCommentSlide();
        await JS.SaveAs("Comment.pptx", documentStream.ToArray());
    }
}